package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	//1.浮点数用64，误差小
	var f float64 = 1
	fmt.Println(f)
	//2.类型转换
	var i int = 2
	f = float64(i)
	fmt.Println(f)
	//3.字符串转浮点型
	s:= "1.25"
	m,_:=strconv.ParseFloat(s,64)
	fmt.Println(m+1)
	//4.浮点型转字符串
	 str:=1.5
	 f1:=strconv.FormatFloat(str,'f',5,64)
	 fmt.Println(f1)
	 //5.字符串长度
	 str1:="123大连民族大学"
	 fmt.Println(len(str1))
	 for _,n:= range str1{
		 fmt.Printf("%c\n", n)
	 }
	 //6.第一次出现的索引和最后一次出现的索引
	 fmt.Println(strings.Index(str1,"大"))
	 fmt.Println(strings.LastIndex(str1,"大"))
	 //7.全变小写，全变大写
	 str2:=" abcFDE "
	 fmt.Println(strings.ToLower(str2))
	 fmt.Println(strings.ToUpper(str2))
	 //8.去掉指定字符空格*
	 fmt.Println(strings.Trim(str2," "))
	 //9.常量生成器,iota初始值为0，递增1
	 const (
	 	a = iota //iota = 0
	 	b 		//iota = 1
	 	c		//iota = 2
	 )
	 fmt.Println(a,b,c)
}

